/*
 * @Author: Wangtao
 * @Date: 2020-10-30 16:39:43
 * @LastEditors: Wangtao
 * @LastEditTime: 2021-04-14 10:00:38
 */
/**
 * Created by licc on 29/10/2020.
 * 与子应用通信都用这个vuex，弃用qiankun自带的initGlobalState
 */
import { VuexModule, Module, Mutation, Action, getModule } from 'vuex-module-decorators'
import router from '@/router/handleRoute'
import store from '@/store'
export interface TemplateConfigState {
  templateConfigData: any
}

@Module({ dynamic: true, name: 'templateConfig', store, namespaced: false })
class TemplateConfig extends VuexModule implements TemplateConfigState {
  public templateConfigData = {
    applicationId: null,
    worksheetId: ''
  }

  get getTemplateConfigData () {
    return this.templateConfigData
  }

  @Mutation
  public setTemplateConfigData (data: any) {
    this.templateConfigData = data
  }

  @Action
  public routerGoBackFunc () {
    router.push('/setting_center/index/customer_template_setting/setting')
  }
}

export const TemplateConfigModule = getModule(TemplateConfig)
